let mongoose = require('mongoose')
const {Schema} = require("mongoose");
const {getYear, provinceModel} = require("./province_sales");

mongoose.set('strictQuery', true);
mongoose.connect("mongodb://127.0.0.1/epi_thesis")

let citySchema = new Schema({
    city:{//县名
        type:String,
        required: true
    },
    city_code:{//所属市的code
        type:Number,
        required: true
    },
    province_code:{//自身的code
        type:Number,
        required: true
    },
    year:{//销售年份
        type:String,
        required: true
    },
    platform_classification:{//平台分类
        type:Schema.Types.Mixed,
        required: true
    },
    sales:{
        type:Schema.Types.Mixed,
        required:true
    },
    level:{
        type:Number,
        required:true
    }
})

let cityModel = mongoose.model("city_year",citySchema,"city_year")

//操作数据库的方法（在router_handler中调用）
//点击地图查询数据

module.exports = {cityModel}
